package com.common.example.config.controller.vo;

import java.io.Serializable;

/**
 * 页面通用参数
 */
public class PageVo implements Serializable {

	private static final long serialVersionUID = 7924758552789685642L;
	/** 默认页码 = 1 */
	public static final Integer default_pageIndex = 1;
	/** 默认每页行数 = 10 */
	public static final Integer default_pageSize = 10;
	/** 页码,从1开始 */
	private Integer pageIndex = default_pageIndex;
	/** 每页多少行 */
	private Integer pageSize = default_pageSize;
	/** 总共有多少页数据 */
	private Integer pageCount = 0;
	/** 数据总条数 */
	private Long total = 0L;

	public Integer getPageIndex() {
		return pageIndex == null ? default_pageIndex : pageIndex;
	}

	public void setPageIndex(Integer pageIndex) {
		this.pageIndex = pageIndex;
	}

	public Integer getPageSize() {
		return pageSize == null ? default_pageSize : pageSize;
	}

	public void setPageSize(Integer pageSize) {
		this.pageSize = pageSize;
	}

	public Integer getPageCount() {
		return pageCount;
	}

	public void setPageCount(Integer pageCount) {
		this.pageCount = pageCount;
	}

	public Long getTotal() {
		return total;
	}

	public void setTotal(Long total) {
		this.total = total;
		Double val = (double) (total * 1.0 / pageSize);
		this.pageCount = (int) (Math.ceil(val));
	}

}
